﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Nha_hang_phu_hop : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetAppropriateName();
            GetAppropriateRes();
            Get5Res();
        }
    }
    protected void GetAppropriateName()
    {
        try {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetAppropriateDetailByAppropriateID";
            Dal.ParameterCollection = new string[1] { "@PhuHopID"};
            Dal.ValueCollection = new string[1] { Request.QueryString["PhuHopID"].ToString() };
            DataRow dr=Dal.GetDataRow();
            lblAppropriateName.Text=dr["MoTa"].ToString();
            Page.Title = "Điểm Đến Phù Hợp " + dr["MoTa"].ToString();
        }
        catch { }
    }
    protected void GetAppropriateRes()
    {
        try {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetResByAppropriateID";
            Dal.ParameterCollection = new string[1] { "@PhuHopID" };
            Dal.ValueCollection = new string[1] { Request.QueryString["PhuHopID"].ToString()};
            DataTable db=Dal.GetDataTable();
            rptRes.DataSource = db;
            rptRes.DataBind();
        }
        catch { }
    }
    protected void Get5Res()
    {
        SQLHelper Dal = new SQLHelper();
        Dal.Open();
        Dal.CommandType = CommandType.StoredProcedure;
        Dal.CommandText = "SP_GetTop5ResHot";
        DataTable db = Dal.GetDataTable();
        Repeater2.DataSource = db;
        Repeater2.DataBind();
    }
}
